package com.myframework.smhj.hibernate.dao;

import java.io.Serializable;
import java.util.List;

import com.myframework.smhj.common.exception.MyException;
import com.myframework.smhj.hibernate.Entity;
import com.myframework.smhj.hibernate.Paging;
import com.myframework.smhj.hibernate.Searching;
import com.myframework.smhj.hibernate.Page;
import com.myframework.smhj.hibernate.Sorting;


public interface Service<T extends Entity> {

	public T one(Serializable id);

	public List<T> list(T entity);
	
	public List<T> list(T entity, Sorting sort);
	
	public List<T> list(T entity, Sorting sort, String searchWord);
	
	public Page<T> list(T entity, Paging page);
	
	public Page<T> list(T entity, Paging page, String searchWord);
	
	public Page<T> list(T entity, Searching search);
	
	public int count(T entity);

	public int count(T entity, String searchWord);
	
	public void delete(Serializable id);

	public void delete(T entity);
	
	public void remove(T entity) throws MyException;
	   
	public T saveOrUpdate(T entity);
	
	public T addOrEdit(T entity) throws MyException;
	
	public T save(T entity) throws MyException;
	
	public T persist(T entity);

	public T add(T entity) throws MyException;

	public T update(T entity);
	
	public T merge(T entity);
	
	public T edit(T entity) throws MyException;
	
	
}
